//
//  DetailNewsSubView.m
//  LoveLove
//
//  Created by leiyifan on 2019/5/26.
//  Copyright © 2019 wkf. All rights reserved.
//

#import "DetailNewsSubView.h"

@interface DetailNewsSubView()



@end


@implementation DetailNewsSubView

-(UIImageView *)iconView{
    if (!_iconView) {
        _iconView = [UIImageView new];
        _iconView.layer.cornerRadius = 35;
        _iconView.layer.masksToBounds = YES;
        _iconView.backgroundColor = [UIColor grayColor];
    }
    return _iconView;
}

-(UILabel *)storeName{
    if (!_storeName) {
        _storeName = [UILabel new];
        _storeName.text = @"商家名称";
        _storeName.font = [UIFont systemFontOfSize:15];
        _storeName.textColor = [UIColor colorWithHexString:@"#000000"];
    }
    return _storeName;
}
-(UILabel *)storeIntro{
    if (!_storeIntro) {
        _storeIntro = [UILabel new];
        _storeIntro.text = @"商家介绍";
        _storeIntro.font = [UIFont systemFontOfSize:15];
        _storeIntro.textColor = [UIColor colorWithHexString:@"#000000"];
    }
    return _storeIntro;
}
-(UIButton *)likeBtn{
    if (!_likeBtn) {
        _likeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _likeBtn.backgroundColor = [UIColor redColor];
        _likeBtn.layer.cornerRadius = 6;
        _likeBtn.layer.masksToBounds = YES;
        [_likeBtn setTitle:@"关注" forState:UIControlStateNormal];
        [_likeBtn setTitle:@"已关注" forState:UIControlStateSelected];
        [_likeBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    }
    return _likeBtn;
}

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
         [self addSubview:self.iconView];
        [self addSubview:self.storeIntro];
        [self addSubview:self.storeName];
        [self addSubview:self.likeBtn];
        
    }
    return self;
}


-(void)layoutSubviews{
    [super layoutSubviews];
    
    [self.iconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(24);
        make.centerY.equalTo(self.mas_centerY);
        make.size.mas_equalTo(70);
    }];
    
    [self.storeName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.iconView.mas_right).with.offset(10);
        make.bottom.equalTo(self.iconView.mas_centerY).with.offset(-5);
    }];
    [self.storeIntro mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.iconView.mas_right).with.offset(10);
        make.top.equalTo(self.iconView.mas_centerY).with.offset(5);
    }];
    
    [self.likeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.mas_right).with.offset(-24);
        make.centerY.equalTo(self.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(72, 30));
    }];
}

@end
